import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:zootix/screens/login/zt_login.controller.dart';
import 'package:zootix/util/zt_screen_adaper_util.dart';
import 'package:zootix/zt_app_theme.dart';

class ZtConfirmAgreement extends StatelessWidget {
  final _controller = Get.find<ZtLoginController>();
  ZtConfirmAgreement({super.key});

  @override
  Widget build(BuildContext context) {
    return _buildBody();
  }

  Widget _buildBody() {
    return Container(
      height: ZtScreenAdaper.height(300),
      decoration: const BoxDecoration(color: ZtAppTheme.white),
      child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
        ClipRRect(
            borderRadius:
                BorderRadius.circular(ZtScreenAdaper.sp(10)), // 设置圆角的半径
            child: Image(
              image: const AssetImage('assets/icons/logo.png'),
              height: ZtScreenAdaper.width(52),
              width: ZtScreenAdaper.width(52),
            )),
        SizedBox(
          height: ZtScreenAdaper.height(5),
        ),
        Text(
          'ZooTix',
          style: TextStyle(
              fontWeight: FontWeight.bold, fontSize: ZtScreenAdaper.sp(17)),
        ),
        SizedBox(
          height: ZtScreenAdaper.height(20),
        ),
        Padding(
            padding: EdgeInsets.symmetric(horizontal: ZtScreenAdaper.width(20)),
            child: const Text('By using our App you agree with our')),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            InkWell(
              onTap: _controller.onTermTap,
              child: Text('Term of Use',
                  style: TextStyle(
                    decoration: TextDecoration.underline, // 添加下划线
                    decorationColor: const Color.fromRGBO(255, 93, 150, 1),
                    color: const Color.fromRGBO(255, 93, 150, 1),
                  )),
            ),
            Text(
              ' and ',
              style: TextStyle(fontSize: ZtScreenAdaper.sp(16)),
            ),
            InkWell(
                onTap: _controller.onPrivacyPolicyTap,
                child: Text('Privacy Policy',
                    style: TextStyle(
                      decoration: TextDecoration.underline, // 添加下划线
                      decorationColor: const Color.fromRGBO(255, 93, 150, 1),
                      color: const Color.fromRGBO(255, 93, 150, 1),
                    ))),
          ],
        ),
        SizedBox(
          height: ZtScreenAdaper.height(20),
        ),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: ZtScreenAdaper.width(40)),
          child: Container(
            width: ZtScreenAdaper.width(200),
            //在此设置
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(ZtScreenAdaper.sp(30)),
              gradient: const LinearGradient(colors: [
                Color.fromRGBO(175, 243, 32, 1),
                Color.fromRGBO(171, 238, 28, 1),
              ]),
            ),
            child: ElevatedButton(
              style: ButtonStyle(
                padding: MaterialStateProperty.all(
                    EdgeInsets.symmetric(vertical: ZtScreenAdaper.height(12))),
                elevation: MaterialStateProperty.all(0),
                backgroundColor: MaterialStateProperty.all(Colors.transparent),
              ),
              onPressed: () async {
                Get.back(result: true);
              },
              child: Text(
                'Agree and Continue',
                style: TextStyle(
                    fontSize: ZtScreenAdaper.sp(16),
                    color: ZtAppTheme.darkText),
              ),
            ),
          ),
        ),
        SizedBox(
          height: ZtScreenAdaper.height(15),
        ),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: ZtScreenAdaper.width(40)),
          child: Container(
            width: ZtScreenAdaper.width(200),
            //在此设置
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(ZtScreenAdaper.sp(30)),
                color: const Color(0xFFF3F3F3)),
            child: ElevatedButton(
              style: ButtonStyle(
                padding: MaterialStateProperty.all(
                    EdgeInsets.symmetric(vertical: ZtScreenAdaper.height(12))),
                elevation: MaterialStateProperty.all(0),
                backgroundColor: MaterialStateProperty.all(Colors.transparent),
              ),
              onPressed: () async {
                Get.back();
              },
              child: Text(
                'Cancel',
                style: TextStyle(
                    fontSize: ZtScreenAdaper.sp(16),
                    color: const Color.fromRGBO(0, 0, 0, 0.3)),
              ),
            ),
          ),
        )
      ]),
    );
  }
}
